//package com.chicken.es.congif;
//
//import lombok.Data;
//import lombok.extern.log4j.Log4j2;
//import org.apache.http.HttpHost;
//
//import org.apache.http.auth.AuthScope;
//import org.apache.http.auth.UsernamePasswordCredentials;
//import org.apache.http.client.CredentialsProvider;
//import org.apache.http.impl.client.BasicCredentialsProvider;
//import org.apache.http.impl.nio.client.HttpAsyncClientBuilder;
//import org.elasticsearch.client.RestClient;
//import org.elasticsearch.client.RestClientBuilder;
//import org.elasticsearch.client.RestHighLevelClient;
//import org.springframework.beans.factory.annotation.Value;
//import org.springframework.context.annotation.Bean;
//import org.springframework.context.annotation.Configuration;
//import org.springframework.stereotype.Component;
//
///**
// * ES配置类
// *
// * @author wangfenglei
// */
////@ConditionalOnProperty(value = "wfl.base.tools.es.switch", havingValue = "true", matchIfMissing = false)
//@Component
//@Data
//@Configuration
//@Log4j2
//public class EsRestClientConfig {
//    @Value("${es.host}")
//    private String host;
//    @Value("${es.port}")
//    private int port;
//    @Value("${es.scheme}")
//    private String scheme;
//
//    /**
//     * 创建es restHighLevelClient
//     *
//     * @return 客户端
//     */
////    @ConditionalOnProperty(value = "wfl.base.tools.es.switch", havingValue = "true", matchIfMissing = false)
////    @Bean
////    public RestHighLevelClient restHighLevelClient() {
////        final CredentialsProvider credentialsProvider = new BasicCredentialsProvider();
////        credentialsProvider.setCredentials(AuthScope.ANY, new UsernamePasswordCredentials(username, password));
////
////        RestClientBuilder builder = RestClient.builder(
////                        new HttpHost(hostname, port))
////                .setHttpClientConfigCallback(new RestClientBuilder.HttpClientConfigCallback() {
////                    @Override
////                    public HttpAsyncClientBuilder customizeHttpClient(
////                            HttpAsyncClientBuilder httpClientBuilder) {
////                        httpClientBuilder.disableAuthCaching();
////                        return httpClientBuilder
////                                .setDefaultCredentialsProvider(credentialsProvider);
////                    }
////                });
////
////        return new RestHighLevelClient(builder);
////
////
////        return new RestHighLevelClient(
////                RestClient.builder(new HttpHost(host, port, scheme))
////        );
////    }
//}
